package com.yaorange.web.controller.certificate.wxapi;

import com.yaorange.certificate.domain.NjtCertificate;
import com.yaorange.certificate.domain.NjtUserPerfect;
import com.yaorange.certificate.domain.NjtUserRegister;
import com.yaorange.certificate.service.INjtCertificateService;
import com.yaorange.certificate.service.INjtSerialAuthService;
import com.yaorange.certificate.service.INjtUserRegisterService;
import com.yaorange.certificate.vo.NjtLoginVo;
import com.yaorange.certificate.vo.NjtRegisterVo;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.utils.SmsUtils;
import com.yaorange.common.utils.StringUtils;
import com.yaorange.common.utils.ValidateCodeUtils;
import com.yaorange.framework.web.service.SysLoginService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

/**
 * @author coach tam
 * @email 327395128@qq.com
 * @values 坚持灵活 灵活坚持
 * @since 2024/7/15
 */
@Slf4j
@RestController
@RequestMapping("/api")
public class NjtCertificateAPI {
    @Autowired
    private INjtSerialAuthService njtSerialAuthService;
    @Autowired
    private INjtCertificateService njtCertificateService;

    @GetMapping("/serial/checkSerialCode")
    public AjaxResult checkSerialCode(@RequestParam("serialCode") String serialCode) {
        njtSerialAuthService.checkSerialCode(serialCode);
        return AjaxResult.success();
    }


    @PostMapping("/certificate/batchCode")
    public AjaxResult batchCode(@RequestBody NjtCertificate njtCertificate) {
        List<String> codeList = njtCertificateService.batchCode(njtCertificate);
        return AjaxResult.success(codeList);
    }

    @PostMapping("/certificate/batchSaveByCode")
    public AjaxResult batchSaveByCode(@RequestBody List<String> codeList) {
        njtCertificateService.batchSaveByCode(codeList);
        return AjaxResult.success();
    }

}
